package com.yuedou.api.service.sys.impl;

import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yuedou.api.dao.sys.SysConfigMapper;
import com.yuedou.api.entity.sys.SysConfig;
import com.yuedou.api.service.base.impl.BaseServiceImpl;
import com.yuedou.api.service.sys.SysConfigService;
import org.springframework.stereotype.Service;


/**
 * 参数配置 服务层实现
 *
 * @author ruoyi
 */
@Service
public class SysConfigServiceImpl extends BaseServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {

	/**
	 * 根据键名查询参数配置信息
	 * @param configKey 参数key
	 * @return 参数键值
	 */
	@Override
	public String selectConfigByKey(String configKey) {
		SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>()
				.eq(SysConfig::getConfigKey, configKey));
		if (Validator.isNotNull(retConfig)) {
			return retConfig.getConfigValue();
		}
		return StrUtil.EMPTY;
	}
}
